import json


def save_cookies(cookies):
    cookies_dict = {}
    for cookie in cookies:
        cookies_dict[cookie['name']] = cookie['value']

    with open("cookies.txt", 'w+') as file:
        json.dump(cookies_dict, file)


def get_cookies():
    with open('cookies.txt', 'r') as file:
        cookies = json.load(file)
    return cookies

